 <#assign menuId=4>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>填写到货日期-${Application.systemName!}</title>
<meta
	content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'
	name='viewport'>
<!-- bootstrap 3.0.2 -->
<link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- font Awesome -->
<link href="../css/font-awesome.min.css" rel="stylesheet"
	type="text/css" />
<!-- Ionicons -->
<link href="../css/ionicons.min.css" rel="stylesheet" type="text/css" />
<!-- Theme style -->
<link href="../css/AdminLTE.css" rel="stylesheet" type="text/css" />
<!--datetimepicker-->
<link rel="stylesheet" type="text/css" href="../css/datetimepicker/bootstrap-datetimepicker.min.css" />
<link href="../css/myself.css" rel="stylesheet" type="text/css" />
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
<style type="text/css">
* {
	margin: 0;
	padding: 0;
}
.center_td{
	text-align: center;
}
.table tr th{
	text-align: center;
}
#form{
	margin-top: 15px;
}
</style>
</head>
<body class="skin-blue">
	<!-- header logo: style can be found in header.less -->
	<#include "../header.html"/>
	<div class="wrapper row-offcanvas row-offcanvas-left">
		<!-- Left side column. contains the logo and sidebar -->
		<#include "../menu.html"/>

		<!-- Right side column. Contains the navbar and content of the page -->
		<aside class="right-side">
			<section class="content-header">
				<h1>填写到货日期</h1>
				<hr style="margin: 10px 0 0 0" />
			</section>
			<!-- Content Header (Page header) -->
			<section class="content">
				<div class="row">
					<div class="col-md-12">
						<div class="box">
							
							<div class="center">

								<form id="form">
								

								<div class="form-group">
									<table class="table table-bordered" id="tab_encasement_add">
										<tbody>
											<tr class="left-text">
												<th colspan="10">填写到货日期</th>
											</tr>
											<tr class="left-text">
												<th width="10%">箱号</th>
												<th width="10%">箱子尺寸</th>
												<th width="10%">毛重</th>
												<th width="10%">净重</th>
												<th width="10%">颜色编码</th>
												<th width="10%">S</th>
												<th width="10%">M</th>
												<th width="10%">L</th>
												<th width="10%">XL</th>
												<th width="10%">合计</th>
											</tr>
								<#list encasementList as  encasement>
									<tr>
									<td colspan="10"> <input type="hidden" name="id" value="${encasement.id!}"/>	
									<div class="row">
                                        <div class="col-md-3">
	                                        <div class="input-group">
	                                        <p>发货日期：&nbsp;&nbsp;<span><#if encasement.deliveryDate??>${encasement.deliveryDate?string("yyyy-MM-dd")}</#if></span></p>
                                            </div>
                                        </div>
                                        <div class="col-md-4">
                                            <p>物流公司：&nbsp;&nbsp;<span>${encasement.deliver!}</span></p>
                                        </div>
                                        <div class="col-md-4">
                                            <p>物流单号：&nbsp;&nbsp;<span>${encasement.batchNo!}</span></p>
                                        </div>
                                        <div class="col-md-5 clearfix">
                                        	<div class="col-md-2 no-padding pull-left">发货日期：</div>
                                             <div class="input-group date form_datetime col-md-6 no-padding pull-left"> 
                                            
												<input class="form-control" readonly="readonly"  size="60" type="text"
													name="arriveDate" id="arriveDate_${encasement_index}" value="<#if encasement.arriveDate??>${encasement.arriveDate?string("yyyy-MM-dd")}</#if>"> <span
													class="input-group-addon"><span
													class="glyphicon glyphicon-th"></span></span>
											</div> 
											<button type="button" onclick="save('arriveDate_${encasement_index}',${encasement.id})" class="btn btn-primary btn-sm pull-right" style="margin-right: 90px;">保存</button>
                                        </div>
                                        
                                    </div>
							
	</td>
</tr>
<#assign totalSum = 0>
<#list encasement.encasementItems as 	encasementItem>	
																		
											<tr class="center_td">
												<td>${encasementItem.pNo!}</td>
												<td>${encasementItem.size!}</td>
												<td>${encasementItem.grossWeight!}</td>
												<td>${encasementItem.netWeight!}</td>
												<td>${encasementItem.colorCode!}</td>
									            <td name="size">${encasementItem.sAmount!}</td>
									            <td name="size">${encasementItem.mAmount!}</td>
									            <td name="size">${encasementItem.lAmount!}</td>
									            <td name="size">${encasementItem.xlAmouint!}</td>
									            <td name="total">${encasementItem.total!}</td></tr>
									            <#if encasementItem.total??>
									             <#assign totalSum=totalSum+encasementItem.total />
									          
									            </#if>
									            </#list>
											<tr name="amount">
												<td colspan="10"><span id="xamount_sum_span">合计箱数：${encasement.encasementItems?size}箱</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>合计件数：<span>${totalSum}</span>件</span>
												</td>
											</tr>
			</#list>								

										</tbody>
									</table>
								</div>
								
								</form>
							</div>
							<div class="center">
								<button type="button" class="btn btn-primary no-margin" onclick="saveFinish()" style="margin-right: 10px;">提交</button>
							
								<button type="button" class="btn btn-default" onclick="window.location.href='../productionorder/list'">取消</button>
							</div>
						</div>
						<!-- /.box -->


					</div>
					<!-- /.col -->

				</div>
				<!-- /.row -->

			</section>

			

		</aside>
		<!-- /.right-side -->
	</div>
	<!-- ./wrapper -->

	<!-- jQuery 2.0.2 -->
	<script src="../js/jquery.min.js"></script>
	<!-- Bootstrap -->
	<script src="../js/bootstrap.min.js" type="text/javascript"></script>
	<!-- AdminLTE App -->
	<script src="../js/AdminLTE/app.js" type="text/javascript"></script>
	<script src="../js/jquery.form.min.js"></script>
	<!--datepickes-->
	<script
		src="../js/plugins/datetimerpicker/bootstrap-datetimepicker.min.js"
		type="text/javascript"></script>

	<script
		src="../js/plugins/datetimerpicker/locales/bootstrap-datetimepicker.zh-CN.js"
		type="text/javascript"></script>

</body>
<script type="text/javascript">


$(function() {
    $('.form_datetime').datetimepicker({
    	format: 'yyyy-mm-dd hh:00',
       	language:  'zh-CN',  
        weekStart: 1,  
        todayBtn:  1,  
        autoclose: 1,  
        todayHighlight: 1,  
        startView: 2,  
        forceParse: 0,  
        showMeridian: 0,
        minView: 1,
        startDate: new Date()
    });
  
   
});
			
	function save(id,encasementId){
		var arriveDate=$("#"+id).val();
		if(!arriveDate || arriveDate==""){
			alert('发货日期未填');
			return false;
		}
		
		$.ajax({  
            type : "POST",  //
            url : "saveArriveDate",
            data : {  
            	encasementId:encasementId,
            	arriveDate:arriveDate,
            	productionPatternId:${productionPatternId}
            },
            success : function(map) {
 
            	if(map.head.respCode=="0000000"){
                	success("保存成功",function(){
                		window.location.href="addArrivedate?productionPatternId=${productionPatternId}";
                    	
                	});
                	
                	
                	
                }else{
                	alert(map.body);
                }
            }  
        });  
	}
	
	function saveFinish(){
		
		confirm("请核对发货日期都已经填写正确,是否确定提交订单到下一流程?",function(){
			$.ajax({  
	            type : "POST",  //
	            url : "saveArriveDateFinish",
	            data : {  
	            	productionPatternId:${productionPatternId}
	            },
	            success : function(map) {
	 
	            	if(map.head.respCode=="0000000"){
	                	success("保存成功",function(){
	                		window.location.href="../productionorder/list";
	                	});
	                	
	                }else{
	                	alert(map.body);
	                }
	            }  
	        });  
		})
		
	}

        </script>
</html>